package com.app.micaihu.view.army.adapter

import android.widget.ImageView
import com.app.micaihu.R
import com.app.micaihu.custom.view.AttentionView
import com.app.micaihu.view.bean.ArmyMember
import com.app.micaihu.view.utils.loadCircleImage
import com.app.utils.biz.Biz
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * 军团成员列表适配器
 */
class ArmyMemberHeaderListAdapter : BaseQuickAdapter<ArmyMember.Admin, BaseViewHolder>(R.layout.army_member_list_item), LoadMoreModule {

    override fun convert(holder: BaseViewHolder, item: ArmyMember.Admin) {
        holder.apply {
            getView<AttentionView>(R.id.tvAttention).tag = item
            getView<ImageView>(R.id.ivHeadPic).loadCircleImage(item.avatar, R.drawable.user_head_def)
            setText(R.id.tvNickName, item.nickname)
            if (item.grade.isEmpty()) {
                setGone(R.id.tvGrade, true)
            } else {
                setVisible(R.id.tvGrade, true)
                setText(R.id.tvGrade, item.grade)
            }

        }

    }

}